using System;
using System.Collections.Generic;
using System.Text;
using Dominio;
using NHibernate.Cfg;
using NHibernate;

namespace DAP
{
    public class FamilyRepository : AbstractRepository
    {
        public FamilyRepository(): base()
        {

        }

        public IList<Familia> getFamilyList()
        {
            ISession sesion = sesiones.OpenSession();
            ITransaction transaction = sesion.BeginTransaction();
            try
            {
                IQuery query = sesion.CreateQuery("from Familia");
                transaction.Commit();
                return query.List<Familia>();
            }
            catch (Exception)
            {
                transaction.Rollback();
                throw new HibernateException();
            }
        }
    }
}
